package cn.kgc.springday01.service.impl;

import cn.kgc.springday01.anotations.Auto;
import cn.kgc.springday01.dao.EmpDao;
import cn.kgc.springday01.dao.impl.EmpDaoImpl;
import cn.kgc.springday01.dao.impl.EmpDaoNewImpl;
import cn.kgc.springday01.factory.BeanFactory;
import cn.kgc.springday01.service.EmpService;

/**
 * @author 课工场
 * @date 2023/10/6
 * @description
 */
public class EmpServiceImpl implements EmpService {

    //    private EmpDao empDao = new EmpDaoImpl();
    //    private EmpDao empDao = new EmpDaoNewImpl();
    // 使用工厂模式获取实例对象
    //    private EmpDao empDao  = (EmpDao) BeanFactory.getObject(EmpDaoNewImpl.class);

    @Auto
    private EmpDao empDao;


    public EmpDao getEmpDao(){

        return this.empDao;
    }


    @Override
    public Integer delete(Integer id) {

        System.out.println("EmpServiceImpl====>");
        return empDao.delete(id);
    }
}
